<?php 

include './Core/function.php';

if($_POST){
	
	$username = $_POST['username'];
	$password = $_POST['password'];

	$users = include './user.php';

	foreach ($users as $k => $v) {
	 	if($v['username'] == $username){
	 		if($v['password'] == $password){

	 			session_start();
				$_SESSION['username']=$username;
				$_SESSION['id']=$k;

				success('index.php','登录成功');

	 		}else{
	 			error('index.php','登录失败，用户或密码不正确');
	 		}

	 	}else{
	 		error('index.php','登录失败，用户或密码不正确');
	 	}
	 } 








}
















// $arr = array(
// 	'username'=>'zhibinm',
// 	'uid'=>'2',
// 	'face'=>'./Upload/2ycgusgdustda.jpg',
// 	);

// $arr = json_encode($arr);


// $arr = json_decode($arr,TRUE);


// if(1){
// 	setcookie('userinfo',$arr,time()+60);
// }












 ?>